#include <iostream>
#include <string>
using namespace std;

bool check(float temp,int a)
{
	return temp >= 37.5 && a == 1;
}
string name;
float temp;
int a;
int main()
{
	int n;
	cin >> n;
	int cnt = 0;
	for(int i = 1;i <= n;i++)
	{
		cin >> name >> temp >> a;
		if(check(temp,a))
		{
			cout << name << endl;
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}
